﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace TextEmbedding.Core
{
    public class ZhTokenizer
    {
        private static readonly ITokenizer _tokenizer = new JiebaNetTokenizer();
        public static string[] Tokenize(string text, bool shouldCutAll = false)
        {
            // 获取当前类的 Type
            var type = typeof(ZhTokenizer);

            // 获取所在程序集
            Assembly assembly = type.Assembly;

            // 获取 DLL 的完整路径
            string dllPath = assembly.Location;
            string currentDir = Path.GetDirectoryName(dllPath);


            AppDomain.CurrentDomain.SetData("JiebaConfigFileDir", currentDir);

            return _tokenizer.Tokenize(text, shouldCutAll);
        }
    }
}
